package simplebinding.impl;

import simplebinding.interfaces.DataProcessor;
import simplebinding.interfaces.Database;

import com.google.inject.Inject;
/**
 * Database "Implementation" - delegates work to the DataProcessor
 * @author Adam Schaible
 *
 */
public class DatabaseImpl implements Database {

	/** No @Inject needed, loaded by Guice **/
	private final DataProcessor processor;

	/**
	 * Constructor - may be constructed manually, or by Guice
	 * @param processor DataProcessor
	 */
	@Inject
	public DatabaseImpl(DataProcessor processor) {
		this.processor = processor;
		System.out.println("DatabaseImpl created...");
	}

	public String returnData() {
		String fetchedData = fetch();
		return processor.processData(fetchedData);
	}

	private String fetch() {
		return "Data Loaded";
	}
}
